<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>vue组件的全局注册</title>
    <script src="../js/vue.js"></script>
    <style>

    </style>
</head>
<body>

    <div id="app">
        <model1></model1>
        <model1></model1>
    </div>

</body>
<script>
    Vue.component("model1",{//全局注册
        template:"<div><h1>{{title}}</h1><button type='button' @click='btnfn'>点我</button></div>",
        data:function(){
            return {
                title:"hello vue"
            }
        },
        methods:{
            btnfn:function () {
                alert("hello!!!")
            }
        }
    })

    new Vue({
        el:"#app",

    })
</script>
</html>